home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4396 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  49 lines

  1. Path: academy.bastad.se!news
  2. From: sten@academy.bastad.se (Sten Jansson)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Message port
  5. Date: 28 Feb 1996 19:39:41 GMT
  6. Organization: Connection Bastad
  7. Message-ID: <708.6632T987T2426@academy.bastad.se>
  8. NNTP-Posting-Host: academy.bastad.se
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=iso-8859-1
  11. Content-Transfer-Encoding: 8bit
  12. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  13.  
  14. I've tried to create a message-port in a simple test-program. It works,
  15. ,but as soon as I start another program the message-port disappear.
  16. Here is my program:
  17. --
  18. void AddportT(struct MsgPort * MP)
  19. {
  20.  int SIGBIT;
  21.  
  22.  if((SIGBIT=AllocSignal(-1L))==-1)
  23.    exit(0);
  24.  
  25.  MP=  AllocMem(sizeof(struct MsgPort),MEMF_PUBLIC|MEMF_CLEAR);
  26.  if(!MP)
  27.  {
  28.    printf("Kunde inte allockera minne f÷r MsgPort\n");
  29.    exit(1);
  30.  }
  31.  
  32.  MP->mp_Node.ln_Name="WF";
  33.  MP->mp_Node.ln_Pri=-125;
  34.  MP->mp_Node.ln_Type=NT_MSGPORT;
  35.  
  36.  MP->mp_Flags=PA_SIGNAL;
  37.  MP->mp_SigBit=SIGBIT;
  38.  MP->mp_SigTask=(struct Task*)FindTask(0);
  39.  
  40.  AddPort(MP);
  41. }
  42. --
  43.  
  44. Please help me if You know what's wrong! Maybe I should use some
  45. special compiler directives?
  46.  
  47. /Sten
  48.  
  49.